<template>
	<view>

		<daya-clone-navbar :prop_clone_navbar="clone_navbar" :prop_is_ipx="is_ipx" />

		<view class="page">
			<view class="headimg">
				<view class="banner" v-if="lblist.length != 0">
					<view class="swiper-container">
						<swiper :autoplay="true" :circular="true" class="swiper" duration="500" :indicatorDots="lblist.length > 1"
							interval="5000">
							<swiper-item :data-index="index" v-for="(item, index) in lblist" :key="item.unique">
								<image @tap="jumps" class="img" :data-appid="item.appid" :data-id="item.id" :data-name="item.title"
									:data-src="item.src" :data-type="item.item" :data-wb_src="item.src2" :src="item.logo"></image>
							</swiper-item>
						</swiper>
					</view>
				</view>
				<view @tap="lookck" class="hytq">
					<view class="hytq1">会员特权</view>
					<view class="tqsm">特权说明</view>
					<image class="whimg" src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/bangz.png"></image>
				</view>
				<view class="zstq">
					<view class="zstgcl">
						<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/personal/jlj.png"></image>
						<view>特殊标识</view>
					</view>
					<view class="zstgcl">
						<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/personal/zszk.png"></image>
						<view>专属折扣</view>
					</view>
				</view>
			</view>
			<view class="mylhb" v-if="false">
				<view class="mylhbhd">每月免费领红包</view>
				<view>
					会员期内每月可免费领取
					<text style="color: #f44444">4个</text>
					无门槛红包
				</view>
				<view class="hbcells">
					<view class="hbcell"
						:style="'background: ' + (item.state == '1' ? '#fff' : '') + ';color:' + (item.state == '1' ? '' : '')"
						v-for="(item, index) in Coupons" :key="index">
						<view class="hbleft">
							<text>￥</text>
							<text>{{ item.reduce }}</text>
						</view>

						<view class="hbright">无门槛红包</view>

						<view class="hbtop"></view>

						<view class="hbbtm"></view>
					</view>
				</view>
			</view>
			<view class="mylhb">
				<view class="mylhbhd">买单享受专属折扣</view>
				<view>
					会员期内买单可享受
					<text style="color: #f44444">折扣优惠</text>
				</view>
				<view class="zszk" v-if="system.zb_img == ''">
					<view class="zkleft" style="left: 40rpx; top: 0">
						<image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/personal/zshb.png"></image>
						<view>超级会员专享价</view>
						<view>￥29.9</view>
					</view>
					<view class="zkleft" style="background: #efeff4; color: #666; right: 40rpx; bottom: 0">
						<view>原价</view>
						<view>￥59.9</view>
					</view>
					<image class="zszkimg" src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/personal/zszk.png"></image>
				</view>
				<view class="zszk1" v-if="system.zb_img != ''">
					<image :src="system.zb_img"></image>
				</view>
			</view>
			<view @tap="lookck" class="zssm">{{ xtxx.hy_note }}</view>
		</view>
		<navigator class="weui-btn-area" url="kthy">
			<button class="weui-btn" :style="'background:' + color + ';color:#fff;'"
				v-if="userInfo.ishy == '2'">开通会员>></button>
			<button class="weui-btn" :style="'background:' + color + ';color:#fff;'" v-else>我的会员>></button>
		</navigator>

		<!-- parse <template is="xytemp" :data="fwxy:fwxy,xymc:xymc,xynr:xynr"></template> -->
		<block name="xytemp">
			<view class="zhezhao" v-if="!fwxy"></view>
			<view :class="'kcrzxy ' + (fwxy ? '' : 'active')">
				<view class="kcrzxyhd">{{ xymc }}</view>
				<scroll-view scrollY class="kcrzxybd" style="height: 600rpx">
					<rich-text :nodes="xynr"></rich-text>
				</scroll-view>
				<view @tap="queren" class="queren">确定</view>
			</view>
		</block>
	</view>
</template>

<script>
	import cardlist from '@/ymq_canyino2o/dist/cardlist/index';
	import gettel from '@/ymq_canyino2o/dist/gettel/index';
	var app = getApp();
	var util = require('../../utils/util.js');
	export default {
		components: {
			cardlist,
			gettel
		},
		data() {
			return {
				Coupons: [{
						reduce: '5',
						state: '1'
					},
					{
						reduce: '8.8',
						state: '2'
					},
					{
						reduce: '5',
						state: '1'
					},
					{
						reduce: '8.8',
						state: '2'
					},
					{
						reduce: '5',
						state: '1'
					}
				],

				fwxy: true,
				xymc: '会员特权说明',
				xynr: '',
				lblist: '',

				xtxx: {
					hy_note: ''
				},

				system: {
					zb_img: ''
				},

				userInfo: {
					ishy: ''
				},

				lxr: '',
				tel: '',


				color: ''
			};
		},
		onLoad: function(t) {
			app.globalData.setNavigationBarColor(this);
			this.appPageOnLoad(app);
			var that = this;
			app.globalData.util.request({
				url: 'entry/wxapp/ad',
				cachetime: '30',
				success: function(t) {
					console.log(t);
					for (var e = [], a = 0; a < t.data.length; a++) {
						if ('8' == t.data[a].type) {
							e.push(t.data[a]);
						}
					}
					console.log(e);
					that.setData({
						lblist: e,
						xtxx: getApp().globalData.xtxx,
						xynr: getApp().globalData.xtxx.hy_details.replace(/\<img/gi,
							'<img style="width:100%;height:auto" ')
					});
				}
			});
			app.globalData.util.request({
				url: 'entry/wxapp/system',
				cachetime: '0',
				success: function(t) {
					console.log(t);
					that.setData({
						system: t.data
					});
				}
			});
		},
		onReady: function() {},
		onShow: function() {
			var that = this;
			var t = uni.getStorageSync('users').id;
			var a = util.formatTime(new Date()).substring(0, 10).replace(/\//g, '-');
			console.log(a.toString());
			app.globalData.util.request({
				url: 'entry/wxapp/UserInfo',
				cachetime: '0',
				data: {
					user_id: t
				},
				success: function(t) {
					console.log(t);
					if ('' == t.data.dq_time || t.data.dq_time < a.toString()) {
						t.data.ishy = 2;
					}
					that.setData({
						userInfo: t.data,
						lxr: t.data.user_name,
						tel: t.data.user_tel
					});
				}
			});
		},
		onHide: function() {},
		onUnload: function() {},
		onPullDownRefresh: function() {},
		onReachBottom: function() {},
		methods: {
			lookck: function() {
				uni.navigateTo({
					url: '../car/xydtl?title=会员特权说明'
				});
			},

			jumps: function(t) {
				var e = t.currentTarget.dataset.id;
				var a = t.currentTarget.dataset.name;
				var r = t.currentTarget.dataset.appid;
				var n = t.currentTarget.dataset.src;
				var o = t.currentTarget.dataset.wb_src;
				var s = t.currentTarget.dataset.type;
				console.log(e, a, r, n, o, s);
				if (1 == s) {
					console.log(n);
					uni.navigateTo({
						url: n
					});
				} else {
					if (2 == s) {
						uni.setStorageSync('vr', o);
						uni.navigateTo({
							url: '../car/car'
						});
					} else {
						if (3 == s) {
							uni.navigateToMiniProgram({
								appId: r
							});
						}
					}
				}
			},

			queren() {
				console.log('占位：函数 queren 未声明');
			}
		}
	};
</script>
<style>
	@import './hyk.css';
</style>